Skip to content

feat: explain alias resolution decisions - #47

Merged
vmvarela merged 6 commits into
masterfrom
feat/24-explain-resolution
Oct 9, 2026
Merged

vmvarela merged 6 commits into
masterfrom
feat/24-explain-resolution

Conversation

@vmvarela

@vmvarela vmvarela commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Why

When a floating alias resolves unexpectedly, the current inspection view only shows the target. Users need to see which candidates were excluded and why the winner was selected.

Changes

  • Add /model-aliases explain <provider/alias> and a structured explain RPC method.
  • Capture matching, filtering, missing metadata, ranking and model-ID tie-break decisions during the same resolver execution that materializes the alias.
  • List relevant candidates in deterministic order and aggregate unrelated non-matches. Preserve the compact default inspection view.
  • Publish explanations atomically with report rows and confirm them against the final catalog. Failed refreshes or conflicting downstream rewrites return unavailable instead of stale results.
  • Expose only explicit public fields and escape terminal control characters. Preserve strict/tolerant behavior and existing selection semantics.

Review and validation

Applied iterative implementation, defect review and simplification (ponytail). Removed an unnecessary candidate lookup map and kept the implementation in the existing resolver/RPC/TUI flow, without dependencies, strategy frameworks or persistent explanation storage.

  • pnpm run verify: passed; 177 tests, lint, typecheck and build.
  • Packed-product smoke:inspect with OpenCode 2.0.22: passed, including the new explain RPC, history across restarts and zero provider requests.
  • Real-host testing caught an unsupported JSON Schema keyword; simplified the portable schema and reran successfully.
  • CI retains the existing Node 22/24 and OpenCode 2.0.16/2.0.24 matrix.

The existing config-disabled model limitation (#42) remains documented. If strict setup fails, the plugin RPC is unavailable as before.

Follow-up defect review

Added regression tests that failed against the original PR and fixed:

  • A catalog replay during asynchronous history persistence could leave inspect/explain reporting a superseded target as active. Discard the superseded snapshot.
  • Looking up an alias by its escaped display key could associate it with another alias's status. Resolve identity from raw keys instead.
  • Enum validation coerced arrays into strings and accepted incomplete success/failure outcomes. Use strict type checks and require the appropriate winner or failure.

Reused the existing object validator and kept the fixes in the current pipeline. No new dependencies or architectural layers.

Validation after fixes: pnpm run verify (177 passing tests) and packed-product inspection/explanation smoke with OpenCode 2.0.22 (zero provider requests). The original CI passed; the updated commit reruns the same matrix.

Closes #24

@vmvarela vmvarela added the enhancement New feature or request label Oct 9, 2026
@vmvarela
vmvarela merged commit a2a5906 into master Oct 9, 2026
5 checks passed
@vmvarela
vmvarela deleted the feat/24-explain-resolution branch October 9, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add explain mode for alias resolution decisions

1 participant